﻿
//双击事件
var CustomDbClick = function () {//屏蔽双击事件
    //parent.closeWin();
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var planName = record.getData("PlanName");
    var postName = record.getData("PostName");
    var name = record.getData("Name");
    var idCard = record.getData("IDCardNo");
    var auditMan = record.getData("AuditMan");
    document.getElementById("dialog1_h").innerHTML = "查看招聘初选信息";
    document.getElementById("EditUIWindow").src = encodeURI("AutoLoadForm.aspx?r=" + Math.random() + "&entity=hrCandidateSelection&stepType=1&id=" + record.getData("ID") + "&planName=" + planName + "&postName=" + postName + "&name=" + name + "&idCard=" + idCard + "&auditMan=" + auditMan+"&fun=view");
    SetDWH(650, 450, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//添加
var fnCustomAdd = function () {
    document.getElementById("dialog1_h").innerHTML = "新增招聘初选信息";
    document.getElementById("EditUIWindow").src = encodeURI("AutoLoadForm.aspx?r=" + Math.random() + "&entity=hrCandidateSelection&stepType=1");
    SetDWH(650, 450, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//编辑
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
//    var rs = record.getData("StepResult");
//    if (rs == "通过") {
//        alert("初选通过后不允许修改!");
//        return;
    //    }
    var planName = record.getData("PlanName");
    var postName = record.getData("PostName");
    var name = record.getData("Name");
    var idCard = record.getData("IDCardNo");
    var auditMan = record.getData("AuditMan");
    document.getElementById("dialog1_h").innerHTML = "修改招聘初选信息";
    document.getElementById("EditUIWindow").src = encodeURI("AutoLoadForm.aspx?r=" + Math.random() + "&entity=hrCandidateSelection&stepType=1&id=" + record.getData("ID") + "&planName=" + planName + "&postName=" + postName + "&name=" + name + "&idCard=" + idCard + "&auditMan=" + auditMan);
    SetDWH(650, 450, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}

//获取应聘人信息
var dialogCandidateInfo;
var CandidateInfo = null;
//显示对话框
function ShowDialogWindow() {
    SetDWH(720, 380, YAHOO.example.container.dialog6);
    YAHOO.example.container.dialog6.show();
    dialogCandidateInfo = YAHOO.example.container.dialog6;
}

function SaveCandidateInfo(Info) {
    var frame = document.getElementById('EditUIWindow');
    frame.contentWindow.document.getElementById('PlanName').value = Info[0];
    frame.contentWindow.document.getElementById('PostName').value = Info[1];
    frame.contentWindow.document.getElementById('Name').value = Info[2];
    frame.contentWindow.document.getElementById('IdCard').value = Info[3];
    if (typeof (Info[4]) != "undefined") {
        frame.contentWindow.document.getElementById('CandidateID').value = Info[4];
    }
}

//删除招聘初选，第一步
var fnCustomDelete = function () {
    var list = mDataTable.getRecordSet()._records;
    var elist = [];
    dl = [];
    for (var i = 0; i < list.length; i++) {
        if (list[i]._oData["iSun_Selected"] == true) {
            elist.push(list[i]._oData[const_entityID]);
            dl.push(list[i]._sId); //获取行ID；
        }
    }
    if (elist.length == 0) {
        var recordID = myDataTable.getSelectedRows()[0];
        record = myDataTable.getRecord(recordID);
        SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=hrCandidateSelection&id=" + record.getData(const_entityID);
    }
    else {
        SaveUrl = "AjaxData/DataSave.aspx?r=" + Math.random() + "&action=delete&entity=hrCandidateSelection&json=" + elist.join(",");
    }
    YAHOO.example.container.dialog3.show();
}
